﻿@using MiniWeb.Core.Dtos
@using MiniWeb.Core.Entities
@{
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
    var stmplist = ViewData["stmplist"] as List<StmpConfig>;
    var cartlist = ViewData["cartlist"] as List<ShopCartProductInfo>;
    var address = ViewData["address"] as OrderAddress;
}
<link rel="stylesheet" href="/scripts/ui/skins/Aqua/css/ligerui-all.css" />
<script type="text/javascript" src="/scripts/ui/js/ligerBuild.min.js"></script>
<script type="text/javascript" src="/templates/speciality/js/cart.js"></script>
<link href="/templates/speciality/css/shop.css" rel="stylesheet" type="text/css" />
<div class="sub-box">
    <div class="area">
        <div class="sub-current">
            <a href="/index.aspx">网站首页</a>&nbsp;&gt;&nbsp;<a href="/shopping/cart">购物车</a></div>
        <div class="container progress-box">
            <!-- 内容主体 -->
            <link rel="stylesheet" href="/css/validate.css">
            <script type="text/javascript" src="/scripts/jquery/jquery.form.js"></script>
            <script type="text/javascript" src="/scripts/jquery/jquery.validate.min.js"></script>
            <script type="text/javascript" src="/scripts/jquery/messages_cn.js"></script>
            <script type="text/javascript" src="/templates/speciality/js/area.js"></script>
            <script type="text/javascript">
                $(function () {
                    //表单提交
                    AjaxInitForm('order_form', 'btnSubmit', 0);
                    $("#btnSubAdd").bind("click", function () {
                        $("#order_form").attr("url", "/usercenter/saveaddress");
                        AjaxInitForm('order_form', 'btnSubAdd', 0);
                        if ($("#txtRealName").val() == "") {
                            $.ligerDialog.warn('对不起，请填写收货人姓名！');
                            return false;
                        }
                        if ($("#txtProvince").val() == "") {
                            $.ligerDialog.warn('对不起，请选择所属省份！');
                            return false;
                        }
                        if ($("#txtCity").val() == "") {
                            $.ligerDialog.warn('对不起，请选择所属城市！');
                            return false;
                        }
                        if ($("#txtArea").val() == "") {
                            $.ligerDialog.warn('对不起，请选择所属区域！');
                            return false;
                        }
                        if ($("#txtAddress").val() == "") {
                            $.ligerDialog.warn('对不起，请填写详细街道地址！');
                            return false;
                        }
                        if ($("#txtPostCode").val() == "") {
                            $.ligerDialog.warn('对不起，请填写邮政编码！');
                            return false;
                        }
                        if ($("#txtMobile").val() == "" && $("#txtPhone").val() == "") {
                            $.ligerDialog.warn('对不起，电话和手机必须选填一项！');
                            return false;
                        }
                    });
                    $("#btnSubmit").bind("click", function () {
                        if ($("input[name='addressid']:checked").val() == "") {
                            $.ligerDialog.warn('对不起，请确认收货人信息！');
                            return false;
                        }
                        if ($("input[name='distribution_id']:checked").val() == "") {
                            $.ligerDialog.warn('对不起，请确认配送方式！');
                            return false;
                        }
                        if ($("input[name='payment_id']:checked").val() == "") {
                            $.ligerDialog.warn('对不起，请确认支付方式！');
                            return false;
                        }
                    });
                    $("#txtProvince").change(function () {                                   //更改省份
                        change_province($(this).val());
                    });
                    $("#txtCity").change(function () {                                       //更改城市
                        change_city($(this).val());
                    });
                    load_province(22);
                    change_province(22, 234);
                    change_city(234, 0);

                    $(".addressee").find("li").addClass("clear")
                });
            </script>
            <div class="progress-step clear">
                <ul>
                    <li><b></b>1：我的购物车</li>
                    <li class="step"><b></b>2：确认订单信息</li>
                    <li><b></b>3：成功提交订单</li>
                </ul>
            </div>
            <!--结算中心-->
            <form name="order_form" id="order_form" url="/shopping/saveorder">
            <div class="progress-info solid">
                <div class="child addressee">
                    <h5>
                        收货人信息&nbsp;&nbsp;<a href="/usercenter/address" target="_blank" class="close">[管理收货地址]</a></h5>
                    <ul class="mt10 news-ads" style="display: none;">
                        <li class="clear">
                            <label>
                                <em>*</em>收货人：</label>
                            <div class="dd">
                                <input name="RealName" id="txtRealName" type="text">
                                <input name="IsDefault" id="IsDefault" type="hidden" value="true">
                                </div>
                        </li>
                        <li class="address clear">
                            <label>
                                <em>*</em>选择地区：</label>
                            <div class="dd">
                                <select name="Sheng" id="txtProvince">
                                    <option value="" selected="">请选择省份</option>
                                  
                                </select><select name="City" id="txtCity">
                                    <option value="">请选择城市</option>
                                   
                                </select><select name="Qu" id="txtArea">
                                    <option value="">请选择区域</option>
                                    
                                </select>
                            </div>
                        </li>
                        <li class="clear">
                            <label>
                                <em>*</em>街道地址：</label>
                            <div class="dd">
                                <input name="Address" id="txtAddress" type="text"></div>
                        </li>
                        <li class="clear">
                            <label>
                                <em>*</em>邮政编码：</label>
                            <div class="dd">
                                <input name="StmpCode" id="txtPostCode" type="text"><span class="status">有助于快速而准确的确定送货地址</span></div>
                        </li>
                        <li class="clear">
                            <label>
                                <em></em>手机号码：</label>
                            <div class="dd">
                                <input name="Phone" id="txtMobile" type="text"><span class="status">手机号码和电话至少填写一个</span></div>
                        </li>
                        <li class="clear">
                            <label>
                                <em></em>电话号码：</label>
                            <div class="dd">
                                <input name="Tel" id="txtPhone" type="text"><input id="txtIsDefault" name="txtIsDefault"
                                    value="True" type="hidden"></div>
                        </li>
                    </ul>
                    <!-- 修改 2013/6/19 -->
                    <div class="old-ads">
                        <div class="info-no info-ok">
                            <input style="width: auto; height: auto;" id="radio14" name="addressid" value="14"
                                checked="" type="radio">
                            <strong>@address.RealName</strong>&nbsp;收<br>
                            <p>
                                <span id="p14"></span><span id="c14"></span><span id="a14"></span>
                            </p>
                        </div>
                        <script type="text/javascript">
                        load_p(@address.Sheng, "p14@(address.ID)");
                             load_c(@address.Sheng, @address.City, "c14@(address.ID)");
                             load_a(@address.City, @address.Qu, "a14@(address.ID)");
                        </script>
                    </div>
                    <!-- 修改 2013/6/19 -->
                    <div class="btn">
                        <a class="news-adsbtn">使用新的地址</a>
                        <input style="display: none; width: 100px; line-height: 25px; height: 25px;" id="btnSubAdd"
                            class="submit" type="submit" value="保存"></div>
                </div>
                <!-- 2013/6/19 修改 样式在786行 -->
                <script type="text/javascript">
                    $(function () {
                        var ain = $(".addressee").find(".info-no");
                        ain.click(function () {
                            ain.removeClass("info-ok");
                            $(this).addClass("info-ok");
                            $("input[name='addressid']").removeAttr("checked");
                            $(this).find("input[name='addressid']").attr("checked", "checked")
                        });
                        var nds = $(".news-ads");
                        var ods = $(".old-ads");
                        nds.hide();
                        $(".news-adsbtn").click(function () {
                            if (ods.is(":hidden")) {
                                nds.hide();
                                ods.show();
                                $(this).next().hide();
                                $(this).html("使用新的地址")
                            } else {
                                nds.show();
                                ods.hide();
                                $(this).next().show();
                                $(this).html("取消")
                            }
                        })
                    })
                </script>
                <!-- 2013/6/19 修改 -->
               
                <div class="child deilvery">
                    <h5>
                        配送信息</h5>
                    <table>
                        <tbody>
                            <tr>
                                <th class="t2">
                                    配送方式
                                </th>
                                <th>
                                    运费
                                </th>
                                <th>
                                    备注
                                </th>
                            </tr>
                            <!--取得一个DataTable-->
                            @foreach (var item in stmplist)
                            {
                                <tr>
                                    <td class="t2">
                                        <label>
                                            <input name="distribution_id"  type="radio" onclick="FreightAmountTotal(this);"
                                                value="1"><input name="distribution_price" type="hidden" value="@item.StmpMoney">@item.StmpName</label>
                                    </td>
                                    <td class="t3">
                                        @item.StmpMoney 元
                                    </td>
                                    <td>
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                <div class="child payment">
                    <h5>
                        支付方式</h5>
                    <!-- 支付方式选择 -->
                    <ul>
                        <!--取得一个DataTable-->
                        <li class="on"><span>
                            <label style="width: auto">
                                <input checked="" name="payment_id" type="radio" onclick="PaymentAmountTotal(this);"
                                    value="1"><input name="payment_price" type="hidden" value="5.00"><img src="/images/pay_delivery.gif"></label></span>手续费：5.00元<br>
                            收到商品后进行支付，支持现金和刷卡服务。</li>
                        <li class="on"><span>
                            <label style="width: auto">
                                <input name="payment_id" type="radio" onclick="PaymentAmountTotal(this);" value="2"><input
                                    name="payment_price" type="hidden" value="1.00"><img src="/images/pay_balance.gif"></label></span>手续费：1.00元<br>
                            账户余额是客户在您网站上的账户虚拟资金</li>
                        <li class="on"><span>
                            <label style="width: auto">
                                <input name="payment_id" type="radio" onclick="PaymentAmountTotal(this);" value="3"><input
                                    name="payment_price" type="hidden" value="2.00"><img src="/images/pay_alipay.gif"></label></span>手续费：2.00元<br>
                            付款后立即到账，无预付/年费，单笔费率阶梯最低0.7%，无流量限制。</li>
                    </ul>
                    <!-- 支付方式选择 -->
                </div>
                <div class="child products">
                    <h5>
                        商品信息<a href="/shopping/cart" class="close">[返回修改]</a></h5>
                    <table class="info">
                        <tbody>
                            <tr>
                                <th colspan="2" class="heading">
                                    商品名称
                                </th>
                                <th>
                                    单价（元）
                                </th>
                                <th>
                                    数量
                                </th>
                                <th>
                                    金额小计
                                </th>
                            </tr>
                            @foreach (var item in cartlist)
                            {
                                <tr>
                                    <td style="width: 15%">
                                        <a class="img" target="_blank" href="/goods/show-88.aspx">
                                            <img src="@item.ProductImg" height="56" class="img"></a>
                                    </td>
                                    <td align="left">
                                        <a target="_blank" href="/goods/show-88.aspx">@item.ProductName &nbsp; </a>
                                    </td>
                                    <td align="center">
                                        ￥@item.Price<input name="goods_price" type="hidden" value="88.00">
                                    </td>
                                    <td align="center">
                                        @item.Num
                                    </td>
                                    <td align="center">
                                        <font color="#FF0000" size="2">￥<span name="real_amount">@item.TotalRMB</span></font>
                                    </td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
                <div class="u-note">
                    <p>
                        添加备注信息</p>
                    <textarea name="message" class="input" style="width: 250px; height: 35px;"></textarea>
                </div>
                <div class="settle">
                    <p class="sum-info">
                        商品件数：<font color="#FF0000">@cartlist.Sum(c => c.Num)</font> 件 &nbsp; &nbsp;&nbsp;商品金额：<font
                            color="#FF0000">￥<label id="goods_amount">@cartlist.Sum(c => c.TotalRMB)</label></font>&nbsp;
                        &nbsp;+ &nbsp; 运费：<font color="#FF0000">￥<label id="freight_amount">0.00</label></font>&nbsp;
                        &nbsp;+ &nbsp; 支付手续费：<font color="#FF0000">￥<label id="payment_fee">0.00</label></font>
                        <br>
                    </p>
                    @*<p class="sum" id="p_point" style="display: none;">
                        我有0个积分，需要<font size="6" color="#FF0000">0</font>分兑换
                    </p>*@
                    <p class="sum">
                        应付总金额：<font size="6" color="#FF0000">￥<label id="order_amount">176.00</label></font></p>
                    <p class="settle-btn">
                     <input type="hidden" name="stimpid" id="hid_distribution_id" value="" />
                      <input type="hidden" name="paytype" id="hid_paytype_id" value="" />
                      
                        <a class="btn" href="/shopping/cart">返回修改</a>&nbsp;&nbsp;
                        <input id="btnSubmit" name="btnSubmit" type="submit" value="确认提交" class="btn btn-success marL10">
                    </p>
                </div>
            </div>
            </form>
            <!--/结算中心-->
        </div>
    </div>
</div>
